import 'package:cook_dinner/pages/user/user_view/user_control.dart';
import 'package:cook_dinner/pages/user/user_view/user_top.dart';
import 'package:flutter/material.dart';
import 'package:cook_dinner/config/include.dart';

class UserPage extends StatefulWidget {
  const UserPage({Key? key}) : super(key: key);

  @override
  State<UserPage> createState() => _UserPageState();
}

class _UserPageState extends State<UserPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      body: ListView(
        children: const [
          UserTopData(),
          UserControl(),
          ImageCode(img: 'u_m01.png'),
          ImageCode(img: 'u_m02.png'),
        ],
      ),
    );
  }
}

class ImageCode extends StatelessWidget {
  const ImageCode({Key? key, this.img}) : super(key: key);

  final String? img;

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: EdgeInsets.only(left: 26.rpx, right: 32.rpx),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Image.asset(
            'assets/images/$img',
            width: double.infinity,
            height: 177.5.rpx,
          ),
          SizedBox(height: 14.rpx),
          Text(
            '泰式虾干柠檬草沙拉',
            style: TextStyle(
              fontSize: 14.rpx,
              color: const Color(0xff333333),
            ),
          ),
          SizedBox(height: 4.rpx),
          Text(
            '8 道食谱',
            style: TextStyle(
              fontSize: 12.rpx,
              color: const Color(0xff999999),
            ),
          ),
          SizedBox(height: 15.rpx),
        ],
      ),
    );
  }
}
